<!DOCTYPE html>
<#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
<#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />

<html>
<head>
    <meta charset="utf-8">
    <title>报告模板管理基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <!--<link rel="stylesheet" href="${ctx}/qbdmsStatic/style/forms/currencyCss.css">-->
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>

<body class="listBody">

<div class="qbdms-bodyDiv">
    <div class="layui-table-view-body qbdms-add-view-body">
        <form class="formPreview layui-form" requrl="${ctx}/qbdms/wQbdReportTemplate/get"
              lay-filter="wQbdReportTemplateDataForm">
            <div class="qbdms-formTitle">报告模板信息 <i class="qbdms-returnOn closeWindow">返回</i></div>
            <div class="qbdms-formBody" style="margin-bottom: 75px">
                <div class="dragInfo temSpace">
                    <@fillDept.dept css="selectorCont writer-info" id="tbxx"/>
                </div>
                <div class="layui-row">
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="模板名称">模板名称<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" name="name" placeholder="请输入"
                                   autocomplete="off" class="layui-input input-right textInput"
                                   lay-verify="required"
                                   maxlength="50" fieldname="name" lay-reqtext="模板名称是必填项">
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="密级">密级<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@secSelect.sec_select data_src=1 required=true name="secret"/>
                        </div>
                    </div>

                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="型号质量问题统计">型号质量问题统计<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="qualityProblem" verify="required" css="layui-input
                            filter-value" nodeKey="ndtj" reqtext="型号质量问题统计是必填项"
                            filter="qualityProblem"/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label"
                               title="型号质量问题开始时间">型号质量问题开始时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input qualityProblemStartParent">
                            <input type="text" name="qualityProblemStart" id="qualityProblemStart"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled input-right time-init"
                                   lay-verify="required"
                                   maxlength="50" fieldname="qualityProblemStart"
                                   lay-reqtext="型号质量问题开始时间是必填项" readonly>
                        </div>
                    </div>

                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label"
                               title="型号质量问题结束时间">型号质量问题结束时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input qualityProblemEndParent">
                            <input type="text" name="qualityProblemEnd" placeholder="请输入"
                                   autocomplete="off" id="qualityProblemEnd"
                                   class="layui-input dateTimeFiled  input-right time-init"
                                   lay-verify="required"
                                   maxlength="50" fieldname="qualityProblemEnd"
                                   lay-reqtext="型号质量问题结束时间是必填项" readonly>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  " >
                        <label class="layui-form-label qbdms-label"
                               title="院前五位质量问题统计">院前五位质量问题统计<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="qualityProblemTopFive" verify="required"
                            css="layui-input filter-value" nodeKey="ndtj"
                            reqtext="院前五位质量问题统计是必填项" filter="qualityProblemTopFive"/>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="院前五位质量问题统计开始时间">院前五位质量问题统计开始时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input qualityProblemTopFiveStartParent">
                            <input type="text" name="qualityProblemTopFiveStart"
                                   id="qualityProblemTopFiveStart"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled start_time2 input-right time-init"
                                   lay-verify="required"
                                   maxlength="50" fieldname="qualityProblemTopFiveStart"
                                   lay-reqtext="院前五位质量问题统计开始时间是必填项" readonly>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="院前五位质量问题统计结束时间">院前五位质量问题统计结束时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input qualityProblemTopFiveEndParent">
                            <input type="text" name="qualityProblemTopFiveEnd"
                                   id="qualityProblemTopFiveEnd"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled end_time2 input-right time-init"
                                   lay-verify="required"
                                   maxlength="50" fieldname="qualityProblemTopFiveEnd"
                                   lay-reqtext="型号质量问题结束时间是必填项" readonly>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  " >
                        <label class="layui-form-label qbdms-label"
                               title="靶场零故障统计">靶场零故障统计<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="zeroFailShootingRange" verify="required"
                            css="layui-input filter-value" nodeKey="ndydtj"
                            reqtext="靶场零故障统计是必填项" filter="zeroFailShootingRange"/>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="靶场零故障统计开始时间">靶场零故障统计开始时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input zeroFailShootingRangeStartParent">
                            <input type="text"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled start_time3 input-right time-init zeroFailShootingRangeStart"
                                   maxlength="50" fieldname="zeroFailShootingRangeStart"
                                   lay-reqtext="靶场零故障统计开始时间是必填项" readonly>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="靶场零故障统计结束时间">靶场零故障统计结束时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input zeroFailShootingRangeEndParent">
                            <input type="text"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled end_time3 input-right time-init zeroFailShootingRangeEnd"
                                   maxlength="50"
                                   lay-reqtext="靶场零故障统计结束时间是必填项" readonly>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  " >
                        <label class="layui-form-label qbdms-label"
                               title="军贸质量问题统计">军贸质量问题统计<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="militaryTradeQuality" verify="required"
                            css="layui-input filter-value" nodeKey="ndydtj"
                            reqtext="军贸质量问题统计是必填项" filter="militaryTradeQuality"/>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="军贸质量问题统计开始时间">军贸质量问题统计开始时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input militaryTradeQualityStartParent">
                            <input type="text"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled start_time4 input-right time-init militaryTradeQualityStart"
                                   maxlength="50"
                                   lay-reqtext="军贸质量问题统计开始时间是必填项" readonly>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="军贸质量问题统计结束时间">军贸质量问题统计结束时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input militaryTradeQualityEndParent">
                            <input type="text"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled end_time4 input-right time-init militaryTradeQualityEnd"
                                   maxlength="50"
                                   lay-reqtext="军贸质量问题统计结束时间是必填项" readonly>
                        </div>
                    </div>


                    <div class="qbdms-oneForm  " >
                        <label class="layui-form-label qbdms-label"
                               title="售后质量问题统计">售后质量问题统计<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="afterSalesQuality" verify="required"
                            css="layui-input filter-value" nodeKey="ndydtj"
                            reqtext="售后质量问题统计是必填项" filter="afterSalesQuality"/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="售后质量问题统计开始时间">售后质量问题统计开始时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input afterSalesQualityStartParent">
                            <input type="text"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled start_time5 input-right time-init afterSalesQualityStart"
                                   maxlength="50"
                                   lay-reqtext="售后质量问题统计开始时间是必填项" readonly>
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label"
                               title="售后质量问题统计结束时间">售后质量问题统计结束时间<span
                            style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input afterSalesQualityEndParent">
                            <input type="text"
                                   placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input dateTimeFiled end_time5 input-right time-init afterSalesQualityEnd"
                                   maxlength="50"
                                   lay-reqtext="售后质量问题统计结束时间是必填项" readonly>
                        </div>
                    </div>


                </div>
                <div class="layui-hide">
                    <!-- 型号质量 柱折图-->
                    <div id="chart1Bar" style="width: 600px;height:600px;"></div>
                    <!-- 研制型号原因 柱图-->
                    <div id="chart2Bar" style="width: 600px;height:600px;"></div>
                    <!-- 研制型号原因 饼图-->
                    <div id="chart2Pie" style="width: 600px;height:600px;"></div>
                    <!-- 批产型号原因 柱图-->
                    <div id="chart3Bar" style="width: 600px;height:600px;"></div>
                    <!-- 批产型号原因 饼图-->
                    <div id="chart3Pie" style="width: 600px;height:600px;"></div>
                    <!-- 研制型号阶段 柱图-->
                    <div id="chart4Bar" style="width: 600px;height:600px;"></div>
                    <!-- 研制型号阶段 饼图-->
                    <div id="chart4Pie" style="width: 600px;height:600px;"></div>
                    <!-- 批产型号阶段 柱图-->
                    <div id="chart5Bar" style="width: 600px;height:600px;"></div>
                    <!-- 批产型号阶段 饼图-->
                    <div id="chart5Pie" style="width: 600px;height:600px;"></div>
                    <!-- 售后质量问题 柱图-->
                    <div id="chart6Bar" style="width: 600px;height:600px;"></div>
                    <!-- 售后质量问题 饼图-->
                    <div id="chart6Pie" style="width: 600px;height:600px;"></div>
                    <!-- 军贸质量问题 柱图-->
                    <div id="chart7Bar" style="width: 600px;height:600px;"></div>
                    <!-- 军贸质量问题 饼图-->
                    <div id="chart7Pie" style="width: 600px;height:600px;"></div>
                </div>

                <div class="layui-form-item btnformItem">
                    <p>
                    <span id="hideAndShow" >
                        <a lay-submit lay-filter="wQbdReportTemplate" class="layui-btn btn-n privateSubmit qbdms-oneBtn">提交</a>
                    </span>
                        <button type="reset" id="closeWindow" style="margin-left: 10px;"
                                class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">取消
                        </button>
                    </p>
                </div>
            </div>
        </form>
    </div>
</div>

<script src="${ctx}/qbdmsStatic/public/echarts.min.js"></script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>

<script>
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','common','laydate','layer','jquery','setter','publicMethods','propsHandle','qbdmsForm'], function () {
        var $ = layui.jquery;
        var common = layui.common;
        var layer = layui.layer;
        var form = layui.qbdmsForm;
        var formId = '${formDefId}' || '';
        var publicMethods = layui.publicMethods;
        var propsHandle = layui.propsHandle;
        var imageFormat = "PNG";
        var laydate = layui.laydate;
        var defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                formAreaInfo: '.formPreview',
                formAreaInfo: 'html',
                temDate: '.temDate',
                uploadFileBtn: '.uploadFileBtn',
                uploadImgBtn: '.uploadImgBtn',
                richTextArea: '.richTextArea',
                selectInput: '.selectInput',
                radioOptionCont: '.radioOptionCont',
                dataLexiTree: '.dataLexiTree',
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分

        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '${ctx}/qbdms/wQbdReportTemplate/view/list';
        });

        var runId = "${runId}";
        if (runId == null || runId == '') {
            $("#hideAndShow").show();
        }

        // publicMethods.reflashDate({startName:'.start_time1',endName:'.end_time1'});
        // publicMethods.reflashDate({startName:'.start_time2',endName:'.end_time2'});
        // publicMethods.reflashDate({startName:'.start_time3',endName:'.end_time3'});
        // publicMethods.reflashDate({startName:'.start_time4',endName:'.end_time4'});
        // publicMethods.reflashDate({startName:'.start_time5',endName:'.end_time5'});

        function refreshDate(data, elem) {
            laydate.render({
                elem: '#' + elem
                , type: data
                , trick: 'click'
            });
        }

        function refreshDate1(data, elem) {
            laydate.render({
                elem: elem
                , type: data
                , trick: 'click'
            });
        }

        refreshDate("year", "qualityProblemStart");
        refreshDate("year", "qualityProblemEnd");
        refreshDate("year", "qualityProblemTopFiveStart");
        refreshDate("year", "qualityProblemTopFiveEnd");
        form.on('select(zeroFailShootingRange)', function (data) {
            var type = "year";
            if (data.value == "aydtj") {
                type = "month"
            }
            $('.zeroFailShootingRangeStart').attr('type', 'hidden');
            $('#zeroFailShootingRangeStart').remove();
            var zeroFailShootingRangeStart = $('.zeroFailShootingRangeStart').clone().attr('type',
                'text').attr('id', 'zeroFailShootingRangeStart').attr('name',
                'zeroFailShootingRangeStart').attr('fieldname',
                'zeroFailShootingRangeStart').attr('lay-verify',
                'required');
            $(".zeroFailShootingRangeStartParent").append(zeroFailShootingRangeStart);

            refreshDate(type, "zeroFailShootingRangeStart");

            $('.zeroFailShootingRangeEnd').attr('type', 'hidden');
            $('#zeroFailShootingRangeEnd').remove();
            var zeroFailShootingRangeEnd = $('.zeroFailShootingRangeEnd').clone().attr('type',
                'text').attr('id', 'zeroFailShootingRangeEnd').attr('name',
                'zeroFailShootingRangeEnd').attr('fieldname',
                'zeroFailShootingRangeEnd').attr('lay-verify',
                'required');
            $(".zeroFailShootingRangeEndParent").append(zeroFailShootingRangeEnd);
            refreshDate(type, "zeroFailShootingRangeEnd");
        });

        form.on('select(militaryTradeQuality)', function (data) {
            var type = "year";
            if (data.value == "aydtj") {
                type = "month"
            }
            $('.militaryTradeQualityStart').attr('type', 'hidden');
            $('#militaryTradeQualityStart').remove();
            var militaryTradeQualityStart = $('.militaryTradeQualityStart').clone().attr('type',
                'text').attr('id', 'militaryTradeQualityStart').attr('name',
                'militaryTradeQualityStart').attr('fieldname',
                'militaryTradeQualityStart').attr('lay-verify',
                'required');
            $(".militaryTradeQualityStartParent").append(militaryTradeQualityStart);
            refreshDate(type, "militaryTradeQualityStart");

            $('.militaryTradeQualityEnd').attr('type', 'hidden');
            $('#militaryTradeQualityEnd').remove();
            var militaryTradeQualityEnd = $('.militaryTradeQualityEnd').clone().attr('type',
                'text').attr('id', 'militaryTradeQualityEnd').attr('name',
                'militaryTradeQualityEnd').attr('fieldname',
                'militaryTradeQualityEnd').attr('lay-verify',
                'required');
            $(".militaryTradeQualityEndParent").append(militaryTradeQualityEnd);
            refreshDate(type, "militaryTradeQualityEnd");
        });
        form.on('select(afterSalesQuality)', function (data) {
            var type = "year";
            if (data.value == "aydtj") {
                type = "month"
            }
            $('.afterSalesQualityStart').attr('type', 'hidden');
            $('#afterSalesQualityStart').remove();
            var afterSalesQualityStart = $('.afterSalesQualityStart').clone().attr('type',
                'text').attr('id', 'afterSalesQualityStart').attr('name',
                'afterSalesQualityStart').attr('fieldname',
                'afterSalesQualityStart').attr('lay-verify',
                'required');
            $(".afterSalesQualityStartParent").append(afterSalesQualityStart);
            refreshDate(type, "afterSalesQualityStart");

            $('.afterSalesQualityEnd').attr('type', 'hidden');
            $('#afterSalesQualityEnd').remove();
            var afterSalesQualityEnd = $('.afterSalesQualityEnd').clone().attr('type',
                'text').attr('id', 'afterSalesQualityEnd').attr('name',
                'afterSalesQualityEnd').attr('fieldname',
                'afterSalesQualityEnd').attr('lay-verify',
                'required');
            $(".afterSalesQualityEndParent").append(afterSalesQualityEnd);
            refreshDate(type, "afterSalesQualityEnd");

        });

        common.updateForm({
            name: 'wQbdReportTemplateDataForm',
            idValue: "${id}",
            primary: "id",
            beforeSubmitFun: function (data) {

            },
            updateCallback: function (data) {
                if (common.filterRecord(data)) {
                    if ($(".privateSubmit")) {
                        $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
                    }
                    layer.alert(publicMethods.confirmStyle(data.msg),
                        {title: false, skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            window.parent.location.href = '${ctx}/qbdms/wQbdReportTemplate/view/list';
                        });
                } else {
                    layer.alert(publicMethods.confirmStyle(data.msg),
                        {title: false, skin: 'confirm-class'});
                }
                return false;
            },
            getCallback: function (data) {
            }

        });
        var result = false
        form.on('submit(wQbdReportTemplate)', function (data) {
            data.field.qualityProblemStart = data.field.qualityProblemStart + "-01-01";
            data.field.qualityProblemEnd = data.field.qualityProblemEnd + "-12-31";
            data.field.qualityProblemTopFiveStart = data.field.qualityProblemTopFiveStart
                + "-01-01";
            data.field.qualityProblemTopFiveEnd = data.field.qualityProblemTopFiveEnd + "-12-31";
            if (data.field.zeroFailShootingRange == "aydtj") {
                data.field.zeroFailShootingRangeStart = data.field.zeroFailShootingRangeStart
                    + "-01";
                data.field.zeroFailShootingRangeEnd = data.field.zeroFailShootingRangeEnd + "-01";
            } else {
                data.field.zeroFailShootingRangeStart = data.field.zeroFailShootingRangeStart
                    + "-01-01";
                data.field.zeroFailShootingRangeEnd = data.field.zeroFailShootingRangeEnd
                    + "-12-31";
            }
            if (data.field.militaryTradeQuality == "aydtj") {
                data.field.militaryTradeQualityStart = data.field.militaryTradeQualityStart + "-01";
                data.field.militaryTradeQualityEnd = data.field.militaryTradeQualityEnd + "-01";
            } else {
                data.field.militaryTradeQualityStart = data.field.militaryTradeQualityStart
                    + "-01-01";
                data.field.militaryTradeQualityEnd = data.field.militaryTradeQualityEnd + "-12-31";
            }
            if (data.field.afterSalesQuality == "aydtj") {
                data.field.afterSalesQualityStart = data.field.afterSalesQualityStart + "-01";
                data.field.afterSalesQualityEnd = data.field.afterSalesQualityEnd + "-01";
            } else {
                data.field.afterSalesQualityStart = data.field.afterSalesQualityStart + "-01-01";
                data.field.afterSalesQualityEnd = data.field.afterSalesQualityEnd + "-12-31";
            }

            $.ajax({
                url: '${ctx}/qbdms/wQbdReportTemplate/getCharData',
                data: {"param": JSON.stringify(data.field)},
                type: 'post',
                dataType: 'json',
                async: false,
                success: function (res) {
                    var chart1BarVal = firstEchart('chart1Bar', res.data[0]);
                    var chart2BarVal = echartBar('chart2Bar', res.data[2]);
                    var chart2PieVal = echartPie('chart2Pie', res.data[3]);
                    var chart3BarVal = echartBar('chart3Bar', res.data[4]);
                    var chart3PieVal = echartPie('chart3Pie', res.data[5]);
                    var chart4BarVal = echartBar('chart4Bar', res.data[6]);
                    var chart4PieVal = echartPie('chart4Pie', res.data[7]);
                    var chart5BarVal = echartBar('chart5Bar', res.data[8]);
                    var chart5PieVal = echartPie('chart5Pie', res.data[9]);
                    var chart6BarVal = echartBar('chart6Bar', res.data[12]);
                    var chart6PieVal = echartPie('chart6Pie', res.data[13]);
                    var chart7BarVal = echartBar('chart7Bar', res.data[14]);
                    var chart7PieVal = echartPie('chart7Pie', res.data[15]);
                    data.field.chart1Bar = chart1BarVal;
                    data.field.chart2Bar = chart2BarVal;
                    data.field.chart2Pie = chart2PieVal;
                    data.field.chart3Bar = chart3BarVal;
                    data.field.chart3Pie = chart3PieVal;
                    data.field.chart4Bar = chart4BarVal;
                    data.field.chart4Pie = chart4PieVal;
                    data.field.chart5Bar = chart5BarVal;
                    data.field.chart5Pie = chart5PieVal;
                    data.field.chart6Bar = chart6BarVal;
                    data.field.chart6Pie = chart6PieVal;
                    data.field.chart7Bar = chart7BarVal;
                    data.field.chart7Pie = chart7PieVal;
                    data.field.table1 = res.data[1];
                    data.field.table2 = res.data[10];
                    data.field.table3 = res.data[11];
                    result = true
                    if(result) {
                        $.ajax({
                            url: '${ctx}/qbdms/wQbdReportTemplate/save',
                            data: JSON.stringify(data.field),
                            type: 'post',
                            contentType:'application/json',
                            dataType: 'json',
                            async:false,
                            success: function(res) {
                                layer.alert(publicMethods.confirmStyle(res.msg),{title: false,skin: 'confirm-class'}, function (index) {
                                 layer.close(index);
                                    window.location.href = '${ctx}/qbdms/wQbdReportTemplate/view/list';
                                });
                            }

                        })
                    }
                },

            })
        });

        function echartBar(eleId,data) {
            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById(eleId));
            // 使用刚指定的配置项和数据显示图表。
            var option = {
                animation: false,
                title: {
                    text: data.title,
                    x: 'left',
                    y: 'top'
                },
                color: ['#5B8FF9'],
                xAxis: [{
                    type: 'category',
                    data: data.xtitlelist,
                }],
                toolbox: {
                    feature: {
                        saveAsImage: {type: imageFormat}
                    }
                },
                yAxis: [{
                    type: 'value',
                    name: '数量',
                    nameLocation: 'middle',
                    nameTextStyle: {
                        verticalAlign: 'bottom',
                        padding: [20, 20, 30, 440]
                    },
                    axisLine: {
                        lineStyle: {
                            width: 0
                        }
                    }

                }],

                series: [{
                    name: '直接访问',
                    type: 'bar',
                    data: data.datalist,
                    itemStyle: {
                        normal: {
                            label: {
                                show: true, //开启显示
                                textStyle: { //数值样式
                                    color: 'black',
                                    fontSize: 16
                                }
                            }
                        }
                    }
                }]
            };
            myChart.setOption(option);
            var url = getFullCanvasDataURL(eleId);
            return url;
        }
        function echartPie(eleId,data) {
            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById(eleId));
            var optionPie = {
                color:['#5B8FF9','#5AD8A6','#5D7092','#F6BD16','#E86452','#6DC8EC','#945FB9','#FF9845','#1E9493','#FF99C3'],
                animation: false,
                title: {
                    text: data.title,
                    left: 'left'
                },
                legend: {
                    icon: 'circle',
                    orient: 'horizontal',
                    left: 'center',
                    bottom: '50px',
                    data: data.xtitlelist
                },
                toolbox: {
                    feature: {
                        saveAsImage: {type: imageFormat}
                    }
                },
                series: [{
                    name: '访问来源',
                    type: 'pie',
                    radius: '55%',
                    // center: ['50%', '60%'],
                    data: data.datalist,
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        },
                        normal: {
                            label: {
                                show: true,
                                formatter: '{b} : {c} ({d}%)'
                            },
                            labelLine: {
                                show: true
                            }
                        }
                    }
                }]
            };
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(optionPie);
            var url = getFullCanvasDataURL(eleId);
            return url;
        }
        function setEchartTextarea(ele,value) {
            $(ele).val(value)
        }
        function firstEchart(eleId,data) {
            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById(eleId));
            var option = {
                animation: false,
                color:['#5B8FF9','#f6bd16','#5ad8a6','#e86452','#5d7092','#ff9845','#6dc8ec','#ff99c3','#1e9493','#945fb9'],
                title: {
                    text: data.title,
                    x: '20',
                    y: 'top'
                },
                grid:{
                    top:110
                },
                tooltip: {
                    axisPointer: {
                        type: 'cross',
                        crossStyle: {
                            color: '#999'
                        }
                    }
                },
                toolbox: {
                    feature: {
                        saveAsImage: {type: imageFormat}
                    }
                },
                legend: {
                    orient: 'horizontal',
                    left: '20',
                    top: '30',
                    data: data.legend
                },
                xAxis: [
                    {
                        type: 'category',
                        data: data.xAxis,
                        axisPointer: {
                            type: 'shadow'
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        splitLine: {
                            show: true,
                            lineStyle: {
                                type: "dashed"
                            }
                        },
                        name: '数量',
                        // min: 0,
                        // max: 250,
                        // interval: 50,
                        nameLocation: 'middle',
                        nameTextStyle: {
                            color: '#00A8FF',
                            verticalAlign: 'bottom',
                            padding: [20, 20, 10, 20]
                        },
                        axisLine: {
                            lineStyle: {
                                width: 0
                            }
                        },
                        axisTick:{
                            show:false
                        },
                        axisLabel: {
                            formatter: '{value} '
                        },
                        axisLabel: {
                            textStyle: {
                                color: '#00A8FF'
                            }
                        }
                    },
                    {
                        type: 'value',
                        splitLine: {
                            show: true,
                            lineStyle: {
                                type: "dashed"
                            }
                        },
                        name: '百分比',
                        min: 0,
                        max: 100,
                        interval: 5,
                        axisLabel: {
                            formatter: '{value} %'
                        },
                        axisTick:{
                            show:false
                        },
                        nameRotate: -90,
                        nameLocation: 'middle',
                        nameTextStyle: {
                            color: '#000000',
                            verticalAlign: 'bottom',
                            padding: [120, 20, 30, 20]
                        },
                        axisLine: {
                            lineStyle: {
                                width: 0
                            }
                        }
                    }
                ],
                series: data.data
            };
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
            var url = getFullCanvasDataURL(eleId);
            return url;
        }
        function getFullCanvasDataURL(divId) {
            //将第一个画布作为基准。
            var baseCanvas = $("#" + divId).find("canvas").first()[0];
            if (!baseCanvas) {
                return false;
            }
            var width = baseCanvas.width;
            var height = baseCanvas.height;
            var ctx = baseCanvas.getContext("2d");
            //遍历，将后续的画布添加到在第一个上
            $("#" + divId).find("canvas").each(function (i, canvasObj) {
                if (i > 0) {
                    var canvasTmp = $(canvasObj)[0];
                    ctx.drawImage(canvasTmp, 0, 0, width, height);
                }
            });
            //获取base64位的url
            return baseCanvas.toDataURL();
        }
    });


</script>
</body>
</html>